home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / db3amort.arc / AMORT.PRO < prev   
Encoding:
Text File  |  1985-05-07  |  5.7 KB  |  204 lines

  1. *** AMORT.PRO
  2. *** by Morris Pyle 02/03/85
  3.  
  4. PROCEDURE amort
  5.   SET TALK OFF
  6.   *** Ensure that the User has selected the correct program.
  7.   STORE .T. TO contin
  8.   CLEAR
  9.   @  8, 5 SAY "This program prints Loan Amortization schedules. "
  10.   @ 10, 5 SAY "Is this the program you wish to run? (T/F) " GET contin
  11.   READ
  12.   IF .NOT. contin
  13.     SET TALK ON
  14.     RETURN
  15.   ENDIF
  16.  
  17.   *** Initiate the variables needed.
  18.   PUBLIC loan_amt, int_rate, loan_pmt
  19.   STORE CTOD("  /  /  ") TO mdate
  20.   STORE " " TO filler
  21.   STORE .T. TO run
  22.   STORE mdate TO pmtdate
  23.   STORE mdate TO lsdate
  24.   STORE .F. TO first
  25.   STORE SPACE(25) TO name
  26.   STORE 0.00 TO loan_amt
  27.   STORE 0.00 TO loan_pmt
  28.   STORE 0.00 TO int_rate
  29.   STORE 0 TO term
  30.   STORE .F. TO showb
  31.   STORE .F. TO figure
  32.  
  33.   *** Find out if the User wishes the Computer to figure the Mo. Payments.
  34.   CLEAR
  35.   @ 10, 5 SAY 'Do you wish the Computer to figure the Monthly Payments? ;
  36. (T/F) ' GET figure
  37.   READ
  38.   IF figure
  39.     DO pmnt
  40.   ENDIF
  41.  
  42.   *** Set up the Loop to get the User's input.
  43.   DO WHILE .T.
  44.     CLEAR
  45.     STORE .T. TO keepon
  46.     @  1, 5 SAY "*** AMORTIZATION OF SIMPLE INTEREST MONTHLY PAYMENT ;
  47. LOAN ***"
  48.     @  3, 5 SAY "Who is this Schedule for, please? " GET name ;
  49.   PICTURE '!!!!!!!!!!!!!!!!!!!!!!!!!'
  50.     @  5, 5 SAY "What is the Loan Amount, please? " GET loan_amt ;
  51.   PICTURE '999999.99'
  52.     @  7, 5 SAY "What is the Interest Rate, please? " GET int_rate ;
  53. PICTURE '99.99'
  54.     @  9, 5 SAY "What is the Monthly PI Payment Amount, please? " GET ;
  55. loan_pmt PICTURE '9999.99'
  56.     @ 11, 5 SAY "What is the date of the First Payment, please? " GET ;
  57. pmtdate
  58.     @ 12, 5 SAY "(Avoid using dates that do NOT recur every ;
  59. month, such as 29, 30, 31)"
  60.     @ 14, 5 SAY "Is the First Payment for a period of other than one ;
  61. month? (T/F) " GET first
  62.     READ
  63.     IF first
  64.       @ 16, 5 SAY "What is the date the loan starts? " GET lsdate
  65.       @ 18, 5 SAY "What is the Number of months for which you want this ;
  66. schedule? " GET term PICTURE '999'
  67.       @ 20, 5 SAY "Show any Loan Balance at End of Schedule as a Balloon ;
  68. Payment? (T/F) " GET showb
  69.     ELSE
  70.       STORE pmtdate - 28 TO lsdate
  71.       IF DAY(lsdate) > DAY(pmtdate)
  72.         STORE lsdate - (DAY(lsdate) -DAY(pmtdate)) TO lsdate
  73.       ENDIF
  74.       @ 16, 5 SAY "What is the Number of months for which you want this ;
  75. schedule? " GET term PICTURE '999'
  76.       @ 18, 5 SAY "Show any Loan Balance at End of Schedule as a Balloon ;
  77. Payment? (T/F) " GET showb
  78.     ENDIF
  79.     READ
  80.     @ 22, 5 SAY "Are all answers Correct? (T/F) " GET keepon
  81.     READ
  82.     CLEAR GETS
  83.     IF .NOT. keepon
  84.       LOOP
  85.     ELSE
  86.       EXIT
  87.     ENDIF
  88.   ENDDO
  89.   *** Ensure that the printer is on and ready.
  90.   CLEAR
  91.   @  8, 5 SAY "Please be sure your Printer is On and Ready To Print at ;
  92. this time."
  93.   ?
  94.   ACCEPT "Enter Carriage Return (Cr.) when ready to proceed. " TO print
  95.   *** Execute the program.
  96.   CLEAR
  97.   @ 10,10 SAY "Program Processing.... Please Wait."
  98.   USE amort
  99.   APPEND BLANK
  100.   REPLACE payment WITH loan_pmt
  101.   IF first
  102.     REPLACE interest WITH ((int_rate/100)/365 * (pmtdate -lsdate)) * loan_amt
  103.   ELSE
  104.     REPLACE interest WITH (int_rate/100)/12 * loan_amt
  105.   ENDIF
  106.   REPLACE principal WITH payment - interest
  107.   REPLACE balance WITH loan_amt - principal
  108.   REPLACE date WITH pmtdate
  109.   STORE balance TO obalance
  110.   STORE pmtdate TO opmtdate
  111.   SKIP
  112.   DO WHILE RECNO() <= term .AND. obalance > 0
  113.     APPEND BLANK
  114.     REPLACE interest WITH (int_rate/100)/12 * obalance
  115.     IF interest + obalance > loan_pmt
  116.       REPLACE payment WITH loan_pmt
  117.     ELSE
  118.       REPLACE payment WITH interest + obalance
  119.     ENDIF
  120.     REPLACE principal WITH payment - interest
  121.     REPLACE balance WITH obalance - principal
  122.     STORE opmtdate + 31 TO npmtdate
  123.     IF DAY(npmtdate) > DAY(opmtdate)
  124.       STORE npmtdate - (DAY(npmtdate) -DAY(opmtdate)) TO npmtdate
  125.     ENDIF
  126.     REPLACE date WITH npmtdate
  127.     STORE balance TO obalance
  128.     STORE npmtdate TO opmtdate
  129.     SKIP
  130.   ENDDO
  131.   IF showb .AND. obalance > 0
  132.     APPEND BLANK
  133.     REPLACE payment WITH obalance
  134.     REPLACE principal WITH obalance
  135.     REPLACE interest WITH 0
  136.     REPLACE date WITH npmtdate
  137.   ENDIF
  138.  
  139.   *** Set up variables for and run the schedule(s).
  140.   STORE DTOC(lsdate) TO lsdate1
  141.   STORE STR(loan_amt,9,2) TO loanamt
  142.   STORE STR(int_rate,5,2) TO intrate
  143.   DO WHILE .T.
  144.     CLEAR
  145.     REPORT FORM amort HEADING ' ***  $&loanamt &name Loan on &lsdate1 at ;
  146. &intrate.%' NOEJECT TO PRINT
  147.     EJECT
  148.     CLEAR
  149.     @ 10, 5 SAY "Do you wish another copy of this schedule? (T/F) " GET run
  150.     READ
  151.     IF run
  152.       LOOP
  153.     ELSE
  154.       EXIT
  155.     ENDIF
  156.   ENDDO
  157.  
  158.   *** Clear the files and screen and Return.
  159.   ZAP
  160.   USE
  161.   CLEAR
  162.   SET TALK ON
  163.   RETURN
  164.   *** EOF amort
  165.  
  166.  
  167. PROCEDURE pmnt
  168.   STORE 12 TO pmts
  169.   STORE 0.00 TO prin
  170.   STORE 0.00 TO i
  171.   STORE 0 TO mos
  172.   STORE .F. TO another
  173.   DO WHILE .T.
  174.     CLEAR
  175.     @  4,13 SAY '*** PROGRAM TO FIGURE MONTHLY PAYMENTS ON A LOAN ***'
  176.     @  6,15 SAY 'What is Principal Amount of the Loan? ' GET prin ;
  177. PICTURE '999999.99'
  178.     @  8,15 SAY 'What is the Interest Rate on the Loan?    ' GET i ;
  179. PICTURE '99.99'
  180.     @ 10,15 SAY 'How many Months for Payment Amortization?   ' GET mos ;
  181. PICTURE '999'
  182.     @ 11,17 SAY '(30 yrs = 360 mos., 25 yrs = 300 mos.)'
  183.     READ
  184.     STORE mos/12 TO yrs
  185.     STORE ((i/100)*prin/pmts)/(1-1/((i/100)/pmts+1)^(pmts*yrs)) TO pmnt
  186.     @ 13,19 SAY 'The Payment is $'
  187.     @ 13,35 SAY ROUND(pmnt,2) PICTURE '9999.99'
  188.     @ 13,43 SAY 'Per Month!'
  189.     @ 15,15 SAY 'Do you wish to figure another payment? (T/F)  ' GET another
  190.     READ
  191.     IF another
  192.       LOOP
  193.     ELSE
  194.       EXIT
  195.     ENDIF
  196.   ENDDO
  197.   STORE pmnt TO loan_pmt
  198.   STORE i TO int_rate
  199.   STORE prin TO loan_amt
  200.   RETURN
  201.   *** EOF pmnt
  202.  
  203. *** EOF amort.pro
  204.